package cn.biplam.front.component.view.systemManage.sysprivi.privilege.menu.manage;

import cn.biplam.common.ajxcode.SystemCode.MenuCode;
import cn.biplam.common.paramters.UserPriviCaption;
import cn.biplam.common.wrapper.ErrorMessage;
import cn.biplam.common.wrapper.KvMap;
import cn.biplam.common.wrapper.UserInfo;
import cn.biplam.front.component.ComponentBase;
import cn.biplam.front.component.view.systemManage.sysprivi.privilege.menu.navi.MenuNavi;
import cn.biplam.front.html.base.HtmlWindow;
import cn.biplam.front.template.pageFrame.mdManage.MdPage;

/**
 *  菜单权限管理主页面
 * @author XiaoRuxing Dec 7, 20096:43:17 PM
 * @version 1.0
 */
public class MenuPriviMain extends ComponentBase{

	private static String cId = MenuCode.Main;
	
	public MenuPriviMain(UserInfo user, String homeUrl, String recordId,
			KvMap<String, String> params) {
		super(user, homeUrl, recordId, params);
	}
	
	/**
	 * @return 菜单权限管理主页面
	 * @throws ErrorMessage 
	 */
	public HtmlWindow get() throws ErrorMessage{
		
		MdPage page = new MdPage(cId,sHomeUrl,mUser);
		//设置标题和Logo
		page.setTitle(UserPriviCaption.MenuMange_Title, 
				UserPriviCaption.MenuManage_Image);
		//放入菜单管理导航栏
		page.putNavigator(_getNavigator(mUser, sHomeUrl, page.getDomanID()), 
				UserPriviCaption.MenuManage_NaviTitle);
		return page.get();
	}
	
	/**
	 * @return 菜单权限管理导航树
	 * @throws ErrorMessage 
	 */
	private HtmlWindow _getNavigator(UserInfo mUser,String sHomeUrl,
			String targetId) throws ErrorMessage{
		MenuNavi navi = new MenuNavi();
		navi.setTarget(targetId);
		navi.setRootId(this.recordId);
		return navi.get(mUser, sHomeUrl, cId);
	}
}
